package o;

import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.text.TextUtils;
import com.huawei.appmarket.service.appmgr.bean.ApkInstalledInfo;
import com.huawei.hms.framework.network.restclient.hwhttp.dns.DnsConfig;
import java.io.File;
import java.lang.reflect.Field;

public class dsz {
    public static void ˋ(String str) {
        if (!TextUtils.isEmpty(str)) {
            ApkInstalledInfo apkInstalledInfo = new ApkInstalledInfo();
            apkInstalledInfo.ˏ(str);
            PackageManager packageManager = ContentManager.getInstant().getContext().getPackageManager();
            PackageInfo ˊ = epw.ˊ(packageManager, str);
            if (ˊ != null && ॱ(ˊ.applicationInfo)) {
                apkInstalledInfo.ॱ(ˊ.applicationInfo.loadLabel(packageManager).toString());
                apkInstalledInfo.ˏ(ˊ.packageName);
                long length = new File(ˊ.applicationInfo.sourceDir).length();
                apkInstalledInfo.ˎ(epw.ˊ(length));
                apkInstalledInfo.ॱ(length);
                apkInstalledInfo.ˋ(ˊ.lastUpdateTime);
                apkInstalledInfo.ˊ(erw.ˏ(packageManager, ˊ.packageName));
                dtd.ˎ().ˏ(apkInstalledInfo);
            }
        }
    }

    public static void ˊ(String str) {
        dtd.ˎ().ˎ(str);
    }

    public static void ˊ(String str, int i) {
        dtd.ˎ().ˊ(str, i);
    }

    public static boolean ॱ(ApplicationInfo applicationInfo) {
        boolean z;
        int i = applicationInfo.flags;
        Integer ˋ = erz.ˋ();
        int intValue;
        if (ˋ != null) {
            intValue = ˋ.intValue();
        } else {
            intValue = 0;
        }
        if ((DnsConfig.MAX_CACHE_ENTRIES & i) != 0) {
            z = true;
        } else if ((i & 1) == 0) {
            z = true;
        } else if ((i & 1) == 0 || (r1 & i) == 0) {
            z = false;
        } else {
            z = true;
        }
        Field ˏ = erz.ˏ();
        if (ˏ == null) {
            return z;
        }
        try {
            int intValue2 = ((Integer) ˏ.get(applicationInfo)).intValue();
            if ((i & 1) == 0 || (intValue2 & 33554432) == 0) {
                return z;
            }
            return true;
        } catch (IllegalAccessException e) {
            if (!Logger.ˎ()) {
                return z;
            }
            Logger.ˏ("AppInstalledUtils", "can not get hwflags");
            return z;
        } catch (IllegalArgumentException e2) {
            if (!Logger.ˎ()) {
                return z;
            }
            Logger.ˏ("AppInstalledUtils", "can not get hwflags");
            return z;
        }
    }
}
